Skip to content

Update StyleCop.Analyzers to 1.3.180 and fix the new analyzer errors - #2655

Merged
krwq merged 2 commits into
mainfrom
krwq-stylecop-1-3-180
Nov 26, 2026
Merged

krwq merged 2 commits into
mainfrom
krwq-stylecop-1-3-180

Conversation

@krwq

@krwq krwq commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

This pull request was generated with GitHub Copilot.

Dependabot's StyleCop.Analyzers 1.3.180 update (#2654) fails the build. 1.3.180 adds new rules and makes some existing ones stricter, and we treat warnings as errors. CI shows about 10 errors per run (mostly SA1315), because System.Device.Gpio fails first and everything that depends on it is skipped. A full build finds 313.

This PR takes the update and gets the build passing:

  • Disables SA1504 (230 hits). Since 1.3 it also flags get => x; set { ... }, which we use all over the bindings (Relax SA1504 for getter or setter with lambda body DotNetAnalyzers/StyleCopAnalyzers#4391).
  • Disables SA1315 (59 hits). Fixing it means renaming parameters of public overrides, which breaks callers that use named arguments.
  • Fixes the other 24 hits (SA1143, SA1653, SA1003, SA1017 and SA1204). These are formatting and doc-comment changes only.

Debug and Release build locally with 0 warnings, and all tests pass.

Replaces #2654.

Microsoft Reviewers: Open in CodeFlow

- Bump StyleCop.Analyzers from 1.2.0-beta.556 to 1.3.180.
- Disable SA1504: since 1.3 it also flags "get => x; set { ... }"
  (DotNetAnalyzers/StyleCopAnalyzers#4391).
- Disable SA1315: many public overrides use different parameter names,
  and renaming them would break callers that use named arguments.
- List the new rules SA1143, SA1317, SA1653 and SA1654 as errors.
- Fix the remaining SA1143, SA1653, SA1003, SA1017 and SA1204 hits
  (formatting and doc comments only).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@dotnet-policy-service dotnet-policy-service Bot added the area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio label Nov 26, 2026
@krwq
krwq requested a review from pgrawehr November 26, 2026 10:58
The second parts of Mcp23xxx, VideoDevice, Seesaw and Ssd1351 had a copy
(or a leftover) of the type summary. Remove them, so each type keeps a
single <summary> in its main file.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@krwq
krwq merged commit b9c9bb5 into main Nov 26, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-device-bindings Device Bindings for audio, sensor, motor, and display hardware that can used with System.Device.Gpio

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants